home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_gen_itempickup.cog < prev    next >
Text File  |  1999-11-15  |  2KB  |  111 lines

  1. # Jones 3D Cog Script
  2. #
  3. # gen_ItemPickup.cog
  4. #
  5. # [RT]
  6. #
  7. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ===================================================================
  10.  
  11. symbols
  12.  
  13. message        activated
  14. message        callback
  15.  
  16.  
  17. # Change these variables ONLY!
  18. # -------------------------------------------------------------------
  19.  
  20. # Use in_pickup_low or in_pickup_med for the "get" keyframe
  21. keyframe    get=in_pickup_low.key    local
  22.  
  23. # Item-specific voice line
  24. sound        foundSnd=INXJ106.wav    local
  25.  
  26. # Item bin number
  27. int            bin=92                    local
  28.  
  29.  
  30.  
  31. # Don't touch!
  32. # -------------------------------------------------------------------
  33.  
  34. cog            talkCog                    local
  35.  
  36. thing        player                    local
  37. thing        item
  38.  
  39. end
  40.  
  41. # ===================================================================
  42.  
  43. code
  44.  
  45. activated:
  46.  
  47.     player = GetSourceRef();
  48.  
  49.     # Disable player controls and stuff
  50.     if (MakeMeStop() == -1)
  51.         return;
  52.     DeselectWeaponWait(player);
  53.  
  54.     # Make sure this pickup is valid
  55.     if (GetInv(player, bin) < GetInvMax(player, bin))
  56.     {
  57.         StartCutscene(0);
  58.         # Capture player so we get callback message
  59.         CaptureThing(player);
  60.         # Start the animation
  61.         PlayKey(player, get, 5, 0x12, 0); 
  62.     }
  63.  
  64.     # Call the Pickup Lines cog
  65.     talkCog = GetCogByIndex(0);
  66.     SendMessage(talkCog, 27);
  67.  
  68.     # Set up the camera
  69.     if (Rand() < 0.5)
  70.     {
  71.         SetExtCamOffset('0.15 -0.05 0.04');
  72.     }
  73.     else
  74.     {
  75.         SetExtCamOffset('-0.15 -0.05 0.04');
  76.     }
  77.     SetExtCamLookOffset('0.0 0.02 0.0');
  78.  
  79.     return;
  80.  
  81. # -------------------------------------------------------------------
  82.  
  83. callback:
  84.  
  85.     ReleaseThing(player);
  86.  
  87.     # Get rid of the item
  88.     DestroyThing(item);
  89.     
  90.     # Add to inventory
  91.     ChangeInv(player, bin, 1.0);
  92.     SetInvAvailable(player, bin, 1);
  93.     JonesInvItemChanged(bin);
  94.  
  95.     # Wait a bit, then start the voice line
  96.     Sleep(1.0);
  97.     PlayVoice(player, foundSnd, 1.0, 0);
  98.  
  99.     # Reset the camera
  100.     RestoreExtCam();
  101.  
  102.     # Enable player control
  103.     ClearActorFlags(player, 0x200000);
  104.  
  105.     EndCutscene();
  106.  
  107.     return;
  108.  
  109. end
  110.  
  111.